home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
ugoku
/
src.lzh
/
MOVREC
/
MRCXEDT.C
< prev
next >
Wrap
Text File
|
1994-06-01
|
23KB
|
956 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include <file_dlg.h>
#include <tifflib.h>
#include <egb.h>
#include <mos.h>
#include <snd.h>
#include "ugoku.h"
#include "mrcdef.h"
extern int mouseSwCheck() ;
extern int errorCheck( int ) ;
extern char *guiEgbPtr ; /* EGB é╠âÅü[âNâAâhâîâX */
extern char *rbuf ; /* Ä⌐ë╞É╗é╠âÅü[âNâAâhâîâX */
extern char *bbuf ; /* Ä⌐ë╞É╗é╠âÅü[âNâAâhâîâX */
extern int baseDialogId ;
int edtDialogId[32] = -1 ;
int edtNumId[14] = -1 ;
int edtPNumId[15] = -1 ;
int edtMesId[52] = -1 ;
int edtScroId[15] = -1 ;
int edtSFDialogId[10] = -1 ;
int edtSFMesId[10] = -1 ;
int edtBtnId[20] = -1 ;
int edtWNumId[1] = -1 ;
int edtRecNumId[4] = -1 ;
int edtRecBtnId = -1 ;
int edtOkBtnId = -1 ;
int edtCanBtnId = -1 ;
int edtTIconId[2] = -1 ;
int edtSndDialogId = -1 ;
int edtSndListId = -1 ;
int edtSndScrId = -1 ;
int edtSndOkBtnId = -1 ;
int edtSndCanBtnId = -1 ;
int edtSndMesId[3] = -1 ;
static int sndNum[14] ;
static int sndPan[15] ;
static int rect[4] ;
static int mainWait ;
static int timingMode ;
static char fileName[10][16] ;
static int setFlag ;
static char movFileName[100] ;
static int ch71Flag = 1 ;
movEdit( namemov )
char *namemov ;
{
extern int editFrame( char *, char [][16], int ) ;
FILE *fp;
char head[256];
int error ;
int i, j, ret, temp ;
int movframe, movx0, movy0, movx1, movy1, movwait ;
int var, min, max, delta, ptColumn ;
int prt, len, page ;
sv01:
for( i=0 ; i<80 ; i++ )
{
movFileName[i] = namemov[i] ;
if( namemov[i] == '\0' )break ;
}
ret = mov_head_read_and_dsp( namemov, &movframe, &movx0, &movy0,
&movx1, &movy1, &movwait, 0, TL_malloc, TL_free ); /* ë║é╠ëµû╩é╔ò\Ī */
if( ret )return ret ;
if( ( fp = fopen( namemov, "rb" ) ) == NULL )return 1; /* read head */
temp = fread( head, 256, 1, fp );
fclose( fp );
if( temp < 1 )return 1;
if( DWORD(head+0) != 0x32564f4d )return 58;
if( DWORD(head+4) != 16 )return 58;
if( DWORD(head+16) != 320 )return 58;
if( DWORD(head+20) != 240 )return 58;
/* read */
for( i=0 ; i<6 ; i++ )sndNum[i] = BYTE( head + 48 + i );
for( i=0 ; i<8 ; i++ )sndNum[ 6 + i ] = BYTE( head + 64 + i );
for( i=0 ; i<14 ; i++ )
{
temp = BYTE( head + 136 + i );
if( temp >= 128 )temp = temp - 256;
if( temp < -64 )temp = -64;
if( temp > 63 )temp = 63;
sndPan[i] = temp;
}
sndPan[14] = sndPan[13] ;
mainWait = DWORD( head + 28 ); /* âEâGâCâg */
timingMode = BYTE( head + 150 ) & 1 ; /* timing mode */
rect[0] = WORD( head + 32 ); rect[1] = WORD( head + 34 ); /* ì└òW */
rect[2] = WORD( head + 36 ); rect[3] = WORD( head + 38 );
if( rect[0]==0 && rect[1]==0 && rect[2]==0 && rect[3]==0 )
{
rect[2] = 319;
rect[3] = 239;
}
for( i=0 ; i<10 ; i++ )
{
for( j=0 ; j<16 ; j++ )
fileName[i][j] = '\0' ;
}
for( i=0 ; i<8 ; i++ )
{
for( j=0 ; j<8 ; j++ )
{
fileName[i][j] = head[ 72 + i*8 + j ] ;
}
}
for( j=0 ; j<8 ; j++ )
{
fileName[8][j] = head[ 40 + j ] ;
}
for( j=0 ; j<8 ; j++ )
{
fileName[9][j] = head[ 56 + j ] ;
}
/* î│é╠âfü[â^é≡æ╕Ådé╖éΘé╜é▀,âNâèâAü[é═éΓé▀éΘ
for( i=0 ; i<10 ; i++ )
{
if( fileName[i][0] == '\0' )
{
for( j=0 ; j<8 ; j++ )
fileName[i][j] = '\0' ;
}
}
*/
/* ò\Īâpâlâï âAâ^âbâ` */
MMI_SendMessage( edtDialogId[0], MM_ATTACH, 1, baseDialogId ) ;
/* ò\Īâpâlâïé╓âfü[â^é≡ô]æù */
for( i=0 ; i<14 ; i++ )
{
MMI_SendMessage( edtNumId[i], MM_GETNUMBOX, 5,
&var, &min, &max, &delta, &ptColumn ) ;
MMI_SendMessage( edtNumId[i], MM_SETNUMBOX, 5,
sndNum[i], min, max, delta, ptColumn ) ;
}
for( i=0 ; i<15 ; i++ )
{
MMI_SendMessage( edtPNumId[i], MM_GETNUMBOX, 5,
&var, &min, &max, &delta, &ptColumn ) ;
MMI_SendMessage( edtPNumId[i], MM_SETNUMBOX, 5,
sndPan[i], min, max, delta, ptColumn ) ;
MMI_SendMessage( edtScroId[i], MM_GETSCROLL, 5,
&prt, &min, &max, &len, &page ) ;
MMI_SendMessage( edtScroId[i], MM_SETSCROLL, 5,
sndPan[i], min, max,len, page ) ;
}
MMI_SendMessage( edtWNumId[0], MM_GETNUMBOX, 5,
&var, &min, &max, &delta, &ptColumn ) ;
MMI_SendMessage( edtWNumId[0], MM_SETNUMBOX, 5,
mainWait, min, max, delta, ptColumn ) ;
for( i=0 ; i<4 ; i++ )
{
MMI_SendMessage( edtRecNumId[i], MM_GETNUMBOX, 5,
&var, &min, &max, &delta, &ptColumn ) ;
MMI_SendMessage( edtRecNumId[i], MM_SETNUMBOX, 5,
rect[i], min, max, delta, ptColumn ) ;
}
for( i=0 ; i<2 ; i++ ) /* â{â^âôâNâèâAü[ */
MTL_resetFlagObj( edtTIconId[i], (~(MS_UNSELECT | MS_TOGGLE)) ) ;
MTL_setFlagObj( edtTIconId[timingMode+0], (MS_UNSELECT | MS_TOGGLE) ) ;
for( i=0 ; i<10 ; i++ )
MMI_SendMessage( edtSFMesId[i], MM_SETMSG, 1, fileName[i] );
MMI_SendMessage( edtDialogId[21], MM_DETACH, 0 ) ; /* ch71 detach */
MMI_SendMessage( edtDialogId[22], MM_DETACH, 0 ) ;
MMI_SendMessage( edtDialogId[0], MM_SHOW, 0 ) ; /* î⌐é╣éΘ */
/* ch71 attach */
MMI_SendMessage( edtDialogId[21], MM_ATTACH, 1, edtDialogId[2] ) ;
MMI_SendMessage( edtDialogId[22], MM_ATTACH, 1, edtDialogId[3] ) ;
ch71Flag = -1 ;
ch71ckeck() ; /* ch71Flag = -1é╠é╞é½é═init */
MMI_ExecSystem() ; /* Dialogò\Īé╓ÑÑÑâCâxâôâgâïü[âv */
MMI_SendMessage( edtDialogId[0], MM_ERASE, 0 ) ;
MMI_SendMessage( edtDialogId[0], MM_DETACH, 0 ) ;
error = 0 ;
if( setFlag == TRUE )
{
for( i=0 ; i<6 ; i++ )BYTE( head + 48 + i ) = sndNum[i];
for( i=0 ; i<8 ; i++ )BYTE( head + 64 + i ) = sndNum[ 6 + i ];
for( i=0 ; i<14 ; i++ )
{
temp = sndPan[i];
if( temp < -64 )temp = -64;
if( temp > 63 )temp = 63;
BYTE( head + 136 + i ) = temp;
}
DWORD( head + 28 ) = mainWait; /* âEâGâCâg */
BYTE( head + 150 ) = ( (BYTE( head + 150 ) & 0xfe) | timingMode ) ;
/* timing mode */
if( rect[0] > rect[2] )
{ /* ì└òW */
temp = rect[2]; rect[2] = rect[0]; rect[0] = temp;
}
if( rect[1] > rect[3] )
{
temp = rect[3]; rect[3] = rect[1]; rect[1] = temp;
}
WORD( head + 32 ) = rect[0]; WORD( head + 34 ) = rect[1];
WORD( head + 36 ) = rect[2]; WORD( head + 38 ) = rect[3];
for( i=0 ; i<8 ; i++ )
{
for( j=0 ; j<8 ; j++ )
{
head[ 72 + i*8 + j ] = fileName[i][j] ;
}
}
for( j=0 ; j<8 ; j++ )
{
head[ 40 + j ] = fileName[8][j] ;
}
for( j=0 ; j<8 ; j++ )
{
head[ 56 + j ] = fileName[9][j] ;
}
for( i=0 ; i<6 ; i++ ){ /* write protect é╠ÅΩìç6ë±òKùv */
if(
( fp = fopen( namemov, "r+b" ) ) != NULL
)goto sv06;
}
error = 2 ;
goto sv07 ;
sv06:
fseek( fp, 0, SEEK_SET );
temp = fwrite( head, 256, 1, fp );
fclose( fp );
if( temp < 1 )error = 2;
sv07:
if( error == NOERR )
{
extern int playCheck() ;
int frame,x0,y0,x1,y1,wsize;
error
= mov_memory_play_init( namemov, playCheck,&frame,&x0,&y0,&x1,&y1,
&wsize );
if( error == NOERR )
error = editFrame( namemov, fileName, ch71Flag ) ;
}
if( error == NOERR )goto sv01 ;
}
else
{
return NOERR ;
}
if( error )
{
errorCheck( error ) ;
}
return NOERR ;
}
/* ch71(edtDialogId[21ü`22])é╠ùLî°û│î°é≡â`âFâbâNé╖éΘ */
ch71ckeck()
{
int i, n ;
n = 0 ;
for( i=0 ; i<8 ; i++ )
{
if( (DWORD( fileName[i] )!=0) || (DWORD( fileName[i]+4 )!=0) )
{
n = -1 ;
break ;
}
}
if( n )
{
if( ch71Flag != 0 )
{
MTL_setAtrObj( edtDialogId[21], MS_DSPONLYL40 ) ;
MMI_SendMessage( edtDialogId[21], MM_ERASE, 0 ) ;
MMI_SendMessage( edtDialogId[22], MM_SHOW, 0 ) ;
MTL_resetAtrObj( edtDialogId[22], (~MS_DSPONLYL40) ) ;
}
ch71Flag = 0 ;
}
else
{
if( ch71Flag != 1 )
{
MMI_SendMessage( edtDialogId[21], MM_SHOW, 0 ) ;
MTL_resetAtrObj( edtDialogId[21], (~MS_DSPONLYL40) ) ;
MTL_setAtrObj( edtDialogId[22], MS_DSPONLYL40 ) ;
MMI_SendMessage( edtDialogId[22], MM_ERASE, 0 ) ;
}
ch71Flag = 1 ;
}
return NOERR ;
}
/* initDataIRCEDT:edtNumId[0ü`13]:MJ_NUMBOXL40é╠î─é╤Åoé╡è╓Éö */
int edtNumFunc(kobj, messId, argc, pev, trigger)